package com.ruoyi.common.enums;

import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.Map;

/**
 * <p>
 * Title: WorkloadType.java
 * </p>
 * <p>
 * Description:
 * </p>
 * <p>
 * Copyright: Copyright (c) 2009
 * </p>
 * <p>
 * Company: 京北方科技股份有限公司
 * </p>
 * 
 * @author 吴练
 * @date 2009-8-26
 * @version 1.0
 */

public enum WorkloadType {
	扫描("1-SCAN", "凭证扫描"), /* 补扫("2-RESCAN", "补扫"), 版面分类("3-Classify", "版面分类"), */
	人工补录("4-ManualInput", "人工补录"), 强制补录("5-ForceInput", "二次补录"),
	对账单扫描("6-BeBalScan","对账单扫描"),对账单补录("7-BeBalInput","对账单补录")
	,打包("8-Packed","打包"),入箱("9-InBox","入箱");
	//, 重点监督(
	//		"6-ImpAudit", "重点监督"), 人工选择监督("7-manualSelectAudit", "人工选择监督");

	private static Map<String, WorkloadType> codeMap;
	private static Map<String, WorkloadType> nameMap;
	public static Map<String, String> codeNameMap;
	public static Map<String, String> workloadCodeNameMap;
	static {
		codeMap = new HashMap<String, WorkloadType>();
		nameMap = new HashMap<String, WorkloadType>();
		codeNameMap = new LinkedHashMap<String, String>();
		workloadCodeNameMap = new LinkedHashMap<String, String>();
		for (WorkloadType type : WorkloadType.values()) {
			codeMap.put(type.getCode(), type);
			nameMap.put(type.getName(), type);
			codeNameMap.put(type.getCode(), type.getName());
			if(!"6-BeBalScan".equals(type.getCode())&&!"7-BeBalInput".equals(type.getCode())){
				workloadCodeNameMap.put(type.getCode(), type.getName());
			}
		}
	}

	public static String getCodeByName(String name) {
		WorkloadType workType = codeMap.get(name);
		if (workType == null) {
			return null;
		}
		return workType.getCode();
	}

	public static String getNameByCode(String code) {
		WorkloadType workType = codeMap.get(code);
		if (workType == null) {
			return null;
		}
		return workType.getName();
	}

	public static WorkloadType getWorkTypeByCode(String code) {
		return codeMap.get(code);
	}

	private String code;
	private String name;

	private WorkloadType(String code, String name) {
		this.code = code;
		this.name = name;
	}

	public String getCode() {
		return code;
	}

	public String getName() {
		return name;
	}
}
